This page last changed on Jun 25, 2012 by jed.wheeler@involver.com.

These are special context variables which are "global" - meaning they can be used anywhere in an SML template.

name type description
current_locale string The user's current locale (eg. en_US). Can be used to target locale sensitive content.
Example:
{% if current_locale == "en_GB" %}
  Hello, Mate!
{% else %}
  Hello!
{% endif %}
current_country string The user's current country.  IP based (Facebook parses ID and sends us the country, we never see the actual IP which is why it's possible to populate this without an open graph call.)
current_language string The user's current language.
Example:
{{ current_language }}
is_mobile boolean detects whether current user is viewing tab from a mobile device.  Note that other related Global Context Variables may also return true if this returns true - for example, if the user is on an iPhone, both is_mobile and is_iphone will return true.
is_iphone boolean detects whether current user is viewing tab from an iphone
is_android boolean detects whether current user is viewing tab from an android device
is_tablet boolean detects whether current user is viewing tab from a tablet
is_open_web boolean detects whether current user is viewing tab on the open web
request_format string The format of the current request (fbml/iframe).
Example:
{% if request_format == "fbml" %}
  I am in fbml mode
{% else %}
  I am not in fbml mode
{% endif %}
ajax_request boolean Returns true for AJAX requests.
Example:
{% if ajax_request %}
  This is an AJAX request.
{% endif %}
now string Outputs the current time when the page was rendered. This can be used in combination with the ??date filter to create advanced formatting, timestamps, and time-released code.
 
Example:
{{ now | date: "%b %d %Y " }}

results in:

'Aug 04 2010'
is_page_fan boolean Value will be equal to true if the current user is a Facebook Fan
Example:
{% if is_page_fan %}
  fan!
{% else %}
  not a fan!
{% endif %}
is_page_admin boolean Value will be equal to true if the current user is an Admin of the current page.
Example:
{% if is_page_admin %}
  admin!
{% else %}
  not an admin!
{% endif %}
is_logged_out
DEPRECATED - does not work in iFrame apps
boolean Will be true if user is logged out.
Example:
{{ is_logged_out }}
current_user_id string Current facebook user id.
Example:
{{ current_user_id }}

Note: A user must first authorize the Facebook application and reload the page in order for this variable to be available.  Because of this restriction the variable will not be available for most first-time vistors to your tab.

application_url string Outputs the Facebook Fan Page Tab URL
Example:
{{ application_url }}
facebook_page_id string Outputs the Facebook Fan Page ID
Example:
{{ facebook_page_id }}
facebook_page_name string Outputs the Facebook Fan Page Name
Example:
{{ facebook_page_name }}
facebook_app_id string Outputs the Facebook App ID
Example:
{{ facebook_app_id }}
campaign_id string Outputs the current campaign id
Example:
{{ campaign_id }}
current_feature_id string Outputs the current feature id
Example:
{{ current_feature_id }}
page_params string Used to access params passed in through Facebook Tab url (see page_params_link)
Example:
{{ page_params.some_key }}
secure_request boolean Used to detect if the page is being served as secure or non-secure.
Example:
{% if secure_request %}
<img src="https://myserver.com/my_secure_asset/">
{% else %}
<img src="http://myserver.com/my_non-secure_asset/">
{% endif %}
Document generated by Confluence on Feb 12, 2013 09:09